<?php
	require_once('database.php');
	require_once('display_functions.php');
	$id = $_POST['id'];
	$user = $_POST['user'];
	$comment = $_POST['comment'];
	$name = sqlite_escape_string($_POST['name']);
	$due = mktime($_POST['hour'], $_POST['minute'], 0, $_POST['month'], $_POST['date'], $_POST['year']);
	if($_POST['duedate'] != 1)
		$due = 2012428799;
	$proj = $_POST['proj'];
	$completed = $_POST['completed'];
	$projectID = (isset($_POST['projectID']) ? $_POST['projectID'] : 0);
	$duration = $_POST['duration'];
	editTask($id, $name, 1, $due, 1, 0, 0, $proj, 1, $_POST['assign'], 1);
	setTaskTimeToCompleteInMinutes($id, $duration);
	if(strlen($comment) > 0)	{
		addComment($id, $user, sqlite_escape_string($comment), date('U'));
	}
	setTaskHelpRequired($id, $_POST['help']);
	echo($completed . "\n\t\n");
	printFullTaskList($user, 'cs147organizer.db', $completed, $projectID, ($completed == 1 ? true : false), ($completed == 1 ? 'DESC' : 'ASC'));
?>
